<%@ page import="org.bson.Document" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.mongodb.BasicDBObject" %>
<%@ page import="com.mongodb.client.*" %>
<%@ page import="javax.print.Doc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看学生</title>
</head>
<body>
<%
   String sno=request.getParameter("sno");
    MongoClient conn = MongoClients.create("mongodb://g08:" + URLEncoder.encode("abc@8") + "@mongo.zhledu.cn:27017/g08");
    MongoDatabase g08 = conn.getDatabase("g08");
    MongoCollection<Document> student = g08.getCollection("student");
    Document query=new Document("sno",sno);
    Document s=student.find(query).first();
    conn.close();

%>


<center>
    <form action="doAdd.jsp" method="post">
    <table border="1px">
        <tr>
            <td>学号</td>
            <td><%=s.get("sno")%></td>
        </tr>
        <tr>
            <td>姓名</td>
            <td><%=s.get("name")%></td>
        </tr>
        <tr>
            <td>性别</td>
            <td>
                <%=s.get("sex")%>
            </td>
        </tr>
        <tr>
            <td>年龄</td>
            <td><%=s.get("age")%></td>
        </tr>
        <tr>
            <td>身份证号</td>
            <td><%=s.get("idCard")%></td>
        </tr>
        <tr>
            <td>出生日期</td>
            <td><%=s.get("birthDay")%></td>
        </tr>
        <tr>
            <td>电话号码</td>
            <td><%=s.get("phone")%></td>
        </tr>
        <tr>
            <td>专业</td>
            <td><%=s.get("major")%></td>
        </tr>
        <tr>
            <td>电子邮箱</td>
            <td><%=s.get("email")%></td>
        </tr>
        <tr>
            <td>用户名</td>
            <td><%=s.get("username")%></td>
        </tr>
        <tr>
            <td>地址</td>
            <td><%=s.get("address")%></td>
        </tr>

        <tr align="center">
            <td colspan="2"> <a href="index.jsp">返回</a> </td>
        </tr>

    </table>
    </form>
</center>

</body>
</html>
